//@author A0101119Y
#ifndef GCALVARIABLEMGR_H
#define GCALVARIABLEMGR_H

#include <string>
#include <sstream>
#include <fstream>
#include <map>
#include <Poco/JSON/JSON.h>
#include <Poco/JSON/Parser.h>
#include <Poco/Dynamic/Var.h>
#include <Poco/Exception.h>
#include "CommonObjects.h"
#include "GCalParser.h"

namespace Twentyfifth {
	class GCalVariableMgr {
	protected:
	public:
		GCalParser parser;
		static const int POS_START_OF_LABEL;
		static const std::string LABEL_CLIENT_ID;
		static const std::string LABEL_CLIENT_SECRET;
		static const std::string MESSAGE_FILE_CORRUPTED;
		static const std::string VALUE_CLIENT_ID;
		static const std::string VALUE_CLIENT_SECRET;
		std::map<std::string, std::string> variables;
		void readMapFromFile();
		void writeMapToFile();
	public:
		GCalVariableMgr();
		~GCalVariableMgr();
		std::string getValue(std::string key);
		void setValue(std::string key, std::string value);
		void clearAll();
		bool exists(std::string key);
	};
}

#endif